package cn.sda.leo.springStudy.controller;

import cn.sda.leo.springStudy.annotation.LimitRequest;
import cn.sda.leo.springStudy.service.StockService;
import cn.sda.leo.springStudy.utils.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * \* User: song lei
 * \* Date: 2021/6/21
 * \* Time: 11:28
 * \* Description:
 * \
 */
@RestController
@RequestMapping("/")

public class StockController {

    private final StockService stockService;

    @Autowired  // 通过构造函数实现注入
    public StockController(StockService stockService) {
        this.stockService = stockService;
    }

    @RequestMapping("/")
    @LimitRequest(count = 5)
    public Object findAll(){
        //的
        return Response.makeOKRsp(stockService.findAll());
    }
}
